<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Reversing Bits</title>
    <style>
        /* Light mode colors */
        :root {
            --bg-color: #ffffff;
            --text-color: #333333;
            --nav-bg: #f5f5f5;
        }

        /* Dark mode colors */
        [data-theme="dark"] {
            --bg-color: #1a1a1a;
            --text-color: #ffffff;
            --nav-bg: #2d2d2d;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
            line-height: 1.6;
            margin: 0;
            padding: 20px;
            background-color: var(--bg-color);
            color: var(--text-color);
            transition: background-color 0.3s, color 0.3s;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            position: relative;
            padding-top: 60px;
        }

        .nav-buttons {
            position: fixed;
            top: 20px;
            width: 100%;
            max-width: 800px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background-color: var(--nav-bg);
            padding: 10px;
            border-radius: 8px;
            z-index: 1000;
        }

        .nav-button {
            padding: 8px 16px;
            border: none;
            border-radius: 4px;
            background-color: #007bff;
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .nav-button:hover {
            background-color: #0056b3;
        }

        .theme-toggle {
            background: none;
            border: none;
            cursor: pointer;
            padding: 8px;
            color: var(--text-color);
            font-size: 1.2rem;
        }

        #content {
            margin-top: 20px;
        }

        .page-title {
            display: inline-block;
            margin: 0 10px;
            font-size: 0.9em;
            color: var(--text-color);
        }

        #content a {
            color: #007bff;
            text-decoration: none;
        }

        #content a:hover {
            text-decoration: underline;
        }

        pre {
            background-color: var(--nav-bg);
            padding: 15px;
            border-radius: 5px;
            overflow-x: auto;
        }

        code {
            font-family: 'Consolas', 'Monaco', monospace;
        }
    </style>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.0.2/marked.min.js"></script>
</head>
<body>
    <div class="container">
        <div class="nav-buttons">
            <button id="prevBtn" class="nav-button">
                ← <span id="prevTitle" class="page-title">Previous</span>
            </button>
            <button id="themeToggle" class="theme-toggle">🌞</button>
            <button id="nextBtn" class="nav-button">
                <span id="nextTitle" class="page-title">Next</span> →
            </button>
        </div>
        <div id="content"></div>
    </div>

    <script>
        // Tool titles mapping
        const toolTitles = {
            'README': 'Introduction',
            'angr': 'Angr - Binary Analysis Framework',
            'bap': 'BAP - Binary Analysis Platform',
            'binaryninja': 'Binary Ninja',
            'capstone': 'Capstone - Multi-Architecture Disassembly',
            'diaphora': 'Diaphora - Binary Diffing',
            'dyninst': 'Dyninst - Binary Instrumentation',
            'file': 'File Command',
            'freedom': 'FrEEdom Binary Analysis',
            'frida': 'Frida Dynamic Instrumentation',
            'gas': 'GNU Assembler (GAS)',
            'gdb': 'GDB Debugger',
            'ghidra': 'Ghidra Reverse Engineering',
            'hexdump': 'Hexdump Utility',
            'hopper': 'Hopper Disassembler',
            'idapro': 'IDA Pro',
            'intelXed': 'Intel XED',
            'nasm': 'NASM Assembler',
            'nm': 'NM Symbol Listing',
            'objdump': 'Objdump',
            'ollydbg': 'OllyDbg Debugger',
            'pema': 'PEMA Analysis',
            'pin': 'Intel PIN',
            'qemu': 'QEMU Emulator',
            'radare2': 'Radare2',
            'readelf': 'ReadELF',
            'retdec': 'RetDec Decompiler',
            'rizin': 'Rizin',
            'spike': 'SPIKE Fuzzer',
            'strings': 'Strings Utility',
            'unicorn': 'Unicorn - CPU Emulator',
            'valgrind': 'Valgrind',
            'windbg': 'WinDbg',
            'yara': 'YARA Pattern Matching',
            'zynamics': 'Zynamics',
            'cutter': 'Cutter - Reverse Engineering Platform',
            'binaryanalysistool': 'Binary Analysis Tool (BAT)',
            'miasm': 'Miasm - Reverse Engineering Framework',
            'triton': 'Triton - Dynamic Binary Analysis Framework',
            'peda': 'PEDA - Python Exploit Development Assistance for GDB',
            'dotnetILviewer': 'Dotnet-Offline-IL-Viewer', // Updated key
            'snowman': 'Snowman Decompiler',
            'binaryninjacloud': 'Binary Ninja Cloud'
        };

        // List of markdown files in order
        const pages = [
            'README.md',
            'src/angr.md',
            'src/bap.md',
            'src/binaryninja.md',
            'src/capstone.md',
            'src/diaphora.md',
            'src/dyninst.md',
            'src/file.md',
            'src/freedom.md',
            'src/frida.md',
            'src/gas.md',
            'src/gdb.md',
            'src/ghidra.md',
            'src/hexdump.md',
            'src/hopper.md',
            'src/idapro.md',
            'src/intelXed.md',
            'src/nasm.md',
            'src/nm.md',
            'src/objdump.md',
            'src/ollydbg.md',
            'src/pema.md',
            'src/pin.md',
            'src/qemu.md',
            'src/radare2.md',
            'src/readelf.md',
            'src/retdec.md',
            'src/rizin.md',
            'src/spike.md',
            'src/strings.md',
            'src/unicorn.md',
            'src/valgrind.md',
            'src/windbg.md',
            'src/yara.md',
            'src/zynamics.md',
            'src/cutter.md',
            'src/binaryanalysistool.md',
            'src/miasm.md',
            'src/triton.md',
            'src/peda.md',
            'src/dotnetILviewer.md',
            'src/snowman.md',
            'src/binaryninjacloud.md'
        ];

        // Rest of the JavaScript remains the same
        let currentPageIndex = 0;

        // Theme toggling
        const themeToggle = document.getElementById('themeToggle');
        let isDarkMode = false;

        themeToggle.addEventListener('click', () => {
            isDarkMode = !isDarkMode;
            document.body.setAttribute('data-theme', isDarkMode ? 'dark' : 'light');
            themeToggle.textContent = isDarkMode ? '🌜' : '🌞';
        });

        // Get the display title for a page
        function getPageTitle(filename) {
            const baseName = filename.replace('.md', '').replace('src/', '');
            return toolTitles[baseName] || baseName;
        }

        // Navigation functions
        function updateNavButtons() {
            const prevBtn = document.getElementById('prevBtn');
            const nextBtn = document.getElementById('nextBtn');
            const prevTitle = document.getElementById('prevTitle');
            const nextTitle = document.getElementById('nextTitle');

            prevBtn.style.visibility = currentPageIndex > 0 ? 'visible' : 'hidden';
            nextBtn.style.visibility = currentPageIndex < pages.length - 1 ? 'visible' : 'hidden';

            if (currentPageIndex > 0) {
                prevTitle.textContent = getPageTitle(pages[currentPageIndex - 1]);
            }
            if (currentPageIndex < pages.length - 1) {
                nextTitle.textContent = getPageTitle(pages[currentPageIndex + 1]);
            }
        }

        async function loadPage(index) {
            try {
                const response = await fetch(pages[index]);
                const text = await response.text();
                document.getElementById('content').innerHTML = marked.parse(text);
                currentPageIndex = index;
                updateNavButtons();
                window.scrollTo(0, 0);
            } catch (error) {
                console.error('Error loading page:', error);
                document.getElementById('content').innerHTML = '<p>Error loading content. Please try again.</p>';
            }
        }

        document.getElementById('prevBtn').addEventListener('click', () => {
            if (currentPageIndex > 0) {
                loadPage(currentPageIndex - 1);
            }
        });

        document.getElementById('nextBtn').addEventListener('click', () => {
            if (currentPageIndex < pages.length - 1) {
                loadPage(currentPageIndex + 1);
            }
        });

        // Initial load
        loadPage(0);
    </script>
</body>
</html>